#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 10;
const int maxm = 5000 + 10;
int A[maxn][maxn];
int maxa[maxn][maxm];
int gcd(int a, int b) {return b==0?a:gcd(b, a%b);}
int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    int n, m, k;
    cin >> n >> m >> k;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            A[i][j] = A[j][i] = gcd(i, j);
            A[i][j] = A[j][i] = i*j/A[i][j];
        }
    }

    for (int r = 1; r <= n; ++r) {
        deque<int> q;
        for (int c = 1; c <= m; ++c) {
            int a = A[r][c];

            while(!q.empty() && a>=A[r][q.back()]) q.pop_back();
            if(!q.empty() && c - q.front() == k) q.pop_front();
            q.push_back(c);

            if(c >= k) maxa[r][c-k+1] = A[r][q.front()];
        }
    }
    long long ans = 0;
    for (int c = 1; c <= m - k + 1; ++c)  {
        deque<int> q;
        for (int r = 1; r <= n; ++r){
            int a = maxa[r][c];

            while(!q.empty() && a>=maxa[q.back()][c]) q.pop_back();
            if(!q.empty() && r - q.front() == k) q.pop_front();
            q.push_back(r);

            if(r >= k) ans += maxa[q.front()][c];
        }
    }
    cout << ans;
    return 0;
}